package com.stylefeng.guns.rest.common.persistence.dao;

import com.stylefeng.guns.api.film.ActorVo;
import com.stylefeng.guns.rest.common.persistence.model.MoocActorT;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * 演员表 Mapper 接口
 * </p>
 *
 * @author zhaoluowei
 * @since 2019-09-13
 */
@Mapper
@Repository("moocActorTMapper")
public interface MoocActorTMapper extends BaseMapper<MoocActorT> {

    @Select("SELECT \n" +
            "\t\t\tactor.actor_name AS directorName,\n" +
            "\t\t\tactor.actor_img AS imgAddress ,\n" +
            "\t\t  rela.role_name AS roleName\n" +
            "FROM \n" +
            "     mooc_actor_t actor,\n" +
            "\t\t mooc_film_actor_t rela\n" +
            "WHERE \n" +
            "     actor.UUID = rela.actor_id AND \n" +
            "\t\t rela.film_id = #{filmId} ")
    List<ActorVo> getActors(@Param("filmId") String filmId);


}
